package com.offer;

import com.bean.TreeNode;

/**
 * @Author: huangzhigao
 * @Date: 2023/3/4 17:49
 */
public class offer28 {
    public boolean isSymmetric(TreeNode root) {
        return check(root, root);
    }

    public boolean check(TreeNode head1, TreeNode head2) {
        if(head1 == null && head2 == null){
            return true;
        }
        if(head1==null || head2==null){
            return false;
        }
        return head1.val == head2.val && check(head1.left, head2.right) && check(head1.right, head2.left);
    }
}
